#include<cstdio>
const int maxn=100010;
struct point 
{
	double x,y;
};
struct vector
{
	point start,end;
}a[maxn];
double multi(point p1,point p2,point p0)//P0P1 叉乘P0P2
{
	return (p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y);
}
double max(double x,double y){return x>y?x:y;}
double min(double x,double y){return x<y?x:y;}
bool iscross(vector v1,vector v2)
{
	if(max(v1.start.x,v1.end.x)>=min(v2.start.x,v2.end.x)&&
	   max(v2.start.x,v2.end.x)>=min(v1.start.x,v1.end.x)&&
	   max(v1.start.y,v1.end.y)>=min(v2.start.y,v2.end.y)&&
	   multi(v2.start,v1.end,v1.start)*multi(v1.end,v2.end,v1.start)>=0&&
	   multi(v1.start,v2.end,v2.start)*multi(v2.end,v1.end,v2.start)>=0)
		return true;
	return false;
}
point* intersection(vector u,vector v)
{
	point p;
	if(iscross(u,v))
	{
		p.x=(multi(v.end,u.end,u.start)*v.start.x-multi(v.start,u.end,u.start)*v.end.x)/(multi(v.end,u.end,u.start)-multi(v.start,u.end,u.start));
		p.y=(multi(v.end,u.end,u.start)*v.start.y-multi(v.start,u.end,u.start)*v.end.y)/(multi(v.end,u.end,u.start)-multi(v.start,u.end,u.start));
		return p;
	}
	return NULL;
}
int main()
{
	int n;
	while(scanf("%d",&n)&&n)
	{
		int ans[1100],count=0;
		for(int i=1;i<=n;i++)
		  scanf("%lf%lf%lf%lf",&a[i].start.x,&a[i].start.y,&a[i].end.x,&a[i].end.y);
		ans[++count]=n;
		for(int i=n-1;i>=1;i--)
		{
			bool f=true;
			for(int j=i+1;j<=n;j++)
			   if(iscross(a[i],a[j]))
			   {
				   f=false;
				   break;
			   }
			if(f)ans[++count]=i;
		}
		printf("Top sticks: ");
		for(int i=count;i>1;i--)
			printf("%d, ",ans[i]);
		printf("%d.\n",ans[1]);
	}
	return 0;
}

